package com.cskaoyan.market.controller.admin;

import com.cskaoyan.market.service.MarketRoleService;
import com.cskaoyan.market.service.impl.MarketRoleServiceImpl;
import com.cskaoyan.market.util.JacksonUtil;
import com.cskaoyan.market.util.ResponseUtil;
import com.cskaoyan.market.vo.RoleVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * ClassName: AdminSystemController
 * Package: com.cskaoyan.market.controller
 * Date: 2023/5/6 - 17:49
 * Description:
 */
@RestController
@RequestMapping("admin/role")
public class AdminRoleController {
    @Autowired
    MarketRoleService marketRoleService;

    @GetMapping("options")
    private void options(HttpServletRequest req, HttpServletResponse resp) throws IOException {
        List<RoleVo> roleVos = marketRoleService.options();
        Object o = ResponseUtil.okList(roleVos);
        resp.getWriter().println(JacksonUtil.getObjectMapper().writeValueAsString(o));
    }
}
